package com.huawei.appmarket.service.store.awk.node;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import com.huawei.appmarket.framework.bean.area.AreaAttentionResponse;
import com.huawei.appmarket.service.store.awk.bean.PosterWithTitleCardBean;
import com.huawei.appmarket.service.store.awk.card.PosterWithTitleCard;
import o.cdr;
import o.cfw;
import o.cgz;
import o.chy;
import o.cih;
import o.cvt;
import o.BaseRequest;
import o.dge.d;
import o.dgh;
import o.dgm;
import o.dgq;
import o.Logger;
import o.eib;
import o.eiz;
import o.ewm.h;
import o.ewm.n;

public class PosterWithTitleNode extends cdr {
    public String ˊ = "PosterWithTitleNode";

    public PosterWithTitleNode(Context context) {
        super(context, eib.ͺ());
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        int ˏ = ˏ();
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        for (int i = 0; i < ˏ; i++) {
            View spaceEx;
            if (i != 0) {
                spaceEx = new Space(this.ॱ);
                spaceEx.setLayoutParams(new LinearLayout.LayoutParams(this.ˋ, -1));
                viewGroup.addView(spaceEx);
            }
            spaceEx = from.inflate(h.ˊʼ, null);
            spaceEx.setLayoutParams(layoutParams);
            cih ˎ = ˎ(this.ॱ);
            ˎ.ˏ(spaceEx);
            ˊ(ˎ);
            viewGroup.addView(spaceEx);
        }
        return true;
    }

    protected cgz ˎ(Context context) {
        return new PosterWithTitleCard(context);
    }

    public void ˋ(final chy o_chy) {
        final PosterWithTitleCard posterWithTitleCard = (PosterWithTitleCard) ˊ(0);
        posterWithTitleCard.ˋ().setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ PosterWithTitleNode ˎ;

            public void onClick(View view) {
                if (posterWithTitleCard.ˌ() != null && (posterWithTitleCard.ˌ() instanceof PosterWithTitleCardBean)) {
                    PosterWithTitleCardBean posterWithTitleCardBean = (PosterWithTitleCardBean) posterWithTitleCard.ˌ();
                    if (posterWithTitleCardBean != null && posterWithTitleCardBean.ॱॱ() != null) {
                        dgh.onEvent(new d(this.ˎ.ॱ, n.ˊʼ).ˏ(eiz.ˊ(posterWithTitleCardBean.ॱॱ())).ˋ());
                        if (o_chy != null) {
                            o_chy.ˏ(0, posterWithTitleCard);
                        } else {
                            Logger.ˋ(this.ˎ.ˊ, "cardEventListener is null.");
                        }
                        cvt ˏ = dgq.ˏ(posterWithTitleCardBean.areaId_);
                        if (this.ˎ.ॱ instanceof Activity) {
                            ˏ.setServiceType_(dgm.ˎ((Activity) this.ˎ.ॱ));
                        }
                        cfw.ˎ(ˏ, new IServerCallBack(this) {
                            final /* synthetic */ AnonymousClass2 ˋ;

                            {
                                this.ˋ = r1;
                            }

                            public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
                            }

                            public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
                                if (responseBean instanceof AreaAttentionResponse) {
                                    Logger.ˎ("PosterWithTitleNode", "AreaAttentionResponse result.state_=" + ((AreaAttentionResponse) responseBean).state_);
                                }
                            }
                        });
                    }
                }
            }
        });
    }
}
